import {ecs} from "db://oops-framework/libs/ecs/ECS";
import {HideDatingComp} from "db://assets/script/game/dating/comp/hideDatingComp";
import {DatingViewComp} from "db://assets/script/game/dating/view/datingViewComp";
import {ShowDatingComp} from "db://assets/script/game/dating/comp/showDatingComp";

// 常规大厅系统
export class DatingCommonSystem extends ecs.ComblockSystem implements ecs.IEntityEnterSystem {
    filter(): ecs.IMatcher {
        return ecs.anyOf(HideDatingComp, ShowDatingComp)
    }

    entityEnter(entity: ecs.Entity) {
        if (entity.has(HideDatingComp)) {
            entity.remove(HideDatingComp)
            const comp = entity.get(DatingViewComp)
            if (comp) {
                comp.disableInput()
            }
        } else if (entity.has(ShowDatingComp)) {
            entity.remove(ShowDatingComp)
            const comp = entity.get(DatingViewComp)
            if (comp) {
                comp.enableInput()
            }
        }
    }
}
